import java.io.*;
import java.util.Scanner;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.*;

public class WholePanel extends JPanel
{

	private JPanel upperP, belowP, mainP;
	private JLabel upper_img, below_img;
	private Timer set;

	private Access access;
	private ContactPage contact;



	public WholePanel ()
	{
		setBackground (Color.white);
		setLayout (new BorderLayout ());


		upperP = new JPanel ();
			upperP.setBackground (Color.white);
		upper_img = new JLabel (new ImageIcon ("upper_img.jpg"));
		upperP.add (upper_img);



		belowP = new JPanel ();
			belowP.setBackground (Color.white);
		below_img = new JLabel (new ImageIcon ("below_img.jpg"));
		belowP.add (below_img);



		mainP = new JPanel ();
			mainP.setBackground (Color.white);
			mainP.setPreferredSize (new Dimension (724, 502));

		access = new Access ();
		contact = new ContactPage ();

		mainP.add (access);
		mainP.add (contact);

		access.setVisible (true);
		contact.setVisible (false);



		add (upperP, BorderLayout.NORTH);
		add (mainP, BorderLayout.CENTER);
		add (belowP, BorderLayout.SOUTH);



		set = new Timer (10, new EventsListener ());
		set.start ();
	}





	private class EventsListener implements ActionListener
	{
		public void actionPerformed (ActionEvent event)
		{			
			if (access.getGetAccessed ())// && !access.getGetUnaccessed())
			{
				access.setVisible (false);
				contact.setVisible (true);
				
				access.resetGetAccessed ();
				access.textfield_reset ();
				contact.resetGetUnaccessed ();
			}

			else if (contact.getGetUnaccessed())
			{
				access.setVisible (true);
				contact.setVisible (false);

				access.resetGetAccessed ();
				contact.resetGetUnaccessed ();
			}
		}
	}
}